"""

"""
import time

from selenium.webdriver.android.webdriver import WebDriver
from selenium.webdriver.common.by import By

from CompWchat.Step3.Po.AddMemberPage import AddMemberPage
from CompWchat.Step3.Po.BasePage import BasePage


class ContactPage(BasePage):
    # 子类属性覆盖父类属性值
    # 要测试哪个模块，直接进入对应的页面即可
    _base_url = 'https://work.weixin.qq.com/wework_admin/frame#contacts'
    
    def goto_addmember(self):
        # 在通讯录页面，点击【添加成员】按钮
        # self.driver.refresh()
        try:
            self.find(By.CSS_SELECTOR, ".qui_btn ww_btn.js_add_member").click()
            return AddMemberPage(self.driver)
        except:
            print("天啊，找不到添加成员按钮了，请先忽略！")
            return
            
        # 跳转到添加成员页面：返回目标页面对象
        
    
    def get_memberlist(self):
        """
        获取成员列表
        :return: 返回用于断言的成员列表信息
        """
        ele = self.driver.find_elements(By.CSS_SELECTOR, ".member_colRight_memberTable_td:nth-child(2)")
        # 通过列表推导式获取列表数据信息
        name_list = [i.text for i in ele]
        print(name_list)
        return name_list